﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using LibrarySolution.Model.基础;
using LibrarySolution.Frm;

namespace LibrarySolution.ComMethod
{
    class GlobalVar
    {
        public static FrmMain frmMain;
        public static FrmLogin frmLogin;
        private static FrmJyts frmJs;
        public static FrmJyts FrmJs
        {
            get { return GlobalVar.frmJs; }
            set
            {
                if (GlobalVar.frmJs == null || GlobalVar.frmJs.IsDisposed)
                    GlobalVar.frmJs = value;
            }
        }
        public static Boolean failtopay = true;
        private static GlyEntity glyEntity = null;    // 管理员信息
        internal static GlyEntity GlyEntity
        {
            get
            {
                if (glyEntity == null)
                {
                    return new GlyEntity();
                }
                else
                    return glyEntity;
            }
            set { GlobalVar.glyEntity = value; }
        }

        private static YhxxEntity yhxxEntity = null;    // 用户信息
        internal static YhxxEntity YhxxEntity
        {
            get
            {
                if (yhxxEntity == null)
                {
                    return new YhxxEntity();
                }
                else
                    return yhxxEntity;
            }
            set { GlobalVar.yhxxEntity = value; }
        }

        private static BkxxDetail bkxxDetail = null;    // 书本信息
        internal static BkxxDetail BkxxDetail
        {
            get
            {
                if (bkxxDetail == null)
                {
                    return new BkxxDetail();
                }
                else
                    return bkxxDetail;
            }
            set { GlobalVar.bkxxDetail = value; }
        }

        private static JbxxDetail jbxxDetail = null;    //  级别信息
        internal static JbxxDetail JbxxDetail
        {
            get { return GlobalVar.jbxxDetail; }
            set { GlobalVar.jbxxDetail = value; }
        }

        public static String path = Directory.GetParent(Directory.
            GetParent(Directory.GetCurrentDirectory()).ToString()).ToString();    // 获得路径

        private static bool spGly;
        public static bool SpGly
        {
            get { return GlobalVar.spGly; }
            set { GlobalVar.spGly = value; }
        }

        private static bool noGly;
        public static bool NoGly
        {
            get { return GlobalVar.noGly; }
            set { GlobalVar.noGly = value; }
        }

        private static bool yhEnter;
        public static bool YhEnter
        {
            get { return GlobalVar.yhEnter; }
            set { GlobalVar.yhEnter = value; }
        }
        public static string connString = "Data Source = .\\SQLEXPRESS; " +
            "Initial Catalog = LibrarySolution; Integrated Security = true";

    }
}
